package com.ijunfu.spring.lookup._01_lookup.config;

import com.ijunfu.spring.lookup._01_lookup.service.UserService;
import org.springframework.beans.factory.annotation.Lookup;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *
 * @Title  : 
 * @Author : ijunfu <ijunfu@163.com>
 * @Date   : 2023/11/7 17:45
 * @Version: 1.0
 * @Motto  : 世界很大 世界很小
 *
 */
@Configuration
public class MyConfig {

    @Lookup(value = "userService")
    public UserService userService1() { // 方法体不会执行
        System.out.println(1);
        return null;
    }

    @Bean("userService")
    public UserService userService() {
        System.out.println(0);
        return new UserService();
    }
}
